home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / mpfeel.lha / MPFeel / Modules / counter.em < prev    next >
Lisp/Scheme  |  1992-10-06  |  692b  |  21 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                                           ;;
  3. ;;  EuLisp Module                     Copyright (C) University of Bath 1991  ;;
  4. ;;                                                                           ;;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7. (defmodule counter (standard) ()
  8.  
  9.   (defun make-counter ()
  10.     (let ((count 0))
  11.       (lambda (d)
  12.     (cond
  13.       ((eq d 'up) (setq count (+ count 1)))
  14.       ((eq d 'down) (setq count (- count 1)))
  15.       ((numberp d) (setq count (+ count d)))
  16.       (t 'strange)))))
  17.  
  18.   (deflocal counter (make-counter))
  19.  
  20. )
  21.